package com.lds.erp.order.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.lds.erp.order.OrderCartClient;
import com.lds.erp.order.cart.OrderCartFacade;
import com.lds.erp.order.cart.QueryOrderCartFacade;
import com.lds.erp.order.cart.QueryOrderCashierFacade;
import com.lds.erp.order.cart.order.*;
import com.lds.erp.order.cart.result.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * Created by liuli on 2019/1/8.
 */
@Service
public class OrderCartClientImpl implements OrderCartClient {
    private final static Logger logger = LoggerFactory.getLogger(OrderCartClientImpl.class);
    @Reference(version = "1.0")
    private OrderCartFacade orderCartFacade;

    @Reference(version = "1.0")
    private QueryOrderCartFacade queryOrderCartFacade;

    @Reference(version = "1.0")
    private QueryOrderCashierFacade queryOrderCashierFacade;


    @Override
    public OrderCartDetailResult orderCartDetail(OrderCartDetailOrder order) {
        logger.info("购物车详情,入参={}", order);
        OrderCartDetailResult result = orderCartFacade.orderCartDetail(order);
        logger.info("购物车详情,出参={}", result);
        return result;
    }

    @Override
    public OrderCartUpAndDownResult orderCartUpAndDown(OrderCartUpAndDownOrder order) {
        logger.info("修改购物车,入参={}", order);
        OrderCartUpAndDownResult result = orderCartFacade.orderCartUpAndDown(order);
        logger.info("修改购物车,出参={}", result);
        return result;
    }

    @Override
    public OrderCartDeleteResult orderCartDelete(OrderCartDeleteOrder order) {
        logger.info("删除购物车商品,入参={}", order);
        OrderCartDeleteResult result = orderCartFacade.orderCartDelete(order);
        logger.info("删除购物车商品,出参={}", result);
        return result;
    }

    @Override
    public OrderCartProductDetailResult orderCartProductDetailBySsuCode(OrderCartProductDetailOrder order) {
        logger.info("查询单个商户购物车数量,入参={}", order);
        OrderCartProductDetailResult result = orderCartFacade.orderCartProductDetailBySsuCode(order);
        logger.info("查询单个商户购物车数量,出参={}", result);
        return result;
    }

    @Override
    public OrderCartNumResult orderCartNum(OrderCartNumOrder order) {
        logger.info("购物车商品总数量,入参={}", order);
        OrderCartNumResult result = orderCartFacade.orderCartNum(order);
        logger.info("购物车商品总数量,出参={}", result);
        return result;
    }

    @Override
    public QueryOrderCartResult queryOrderCart(QueryOrderCartOrder order) {
        logger.info("购物车去结算,入参={}", order);
        QueryOrderCartResult result = queryOrderCartFacade.queryOrderCart(order);
        logger.info("购物车去结算,出参={}", result);
        return result;
    }

    @Override
    public QueryOrderCashierResult queryOrderCashier(QueryOrderCashierOrder order) {
        logger.info("收银台,入参={}", order);
        QueryOrderCashierResult result = queryOrderCashierFacade.queryOrderCashier(order);
        logger.info("收银台,出参={}", result);
        return result;
    }

    @Override
    public QueryPayAgainCashierResult queryPayAgainCashier(QueryPayAgainCashierOrder order) {
        logger.info("再次支付收银台,入参={}", order);
        QueryPayAgainCashierResult result = queryOrderCashierFacade.queryPayAgainCashier(order);
        logger.info("再次支付收银台,出参={}", result);
        return result;
    }


}
